$(function(){
    var $el, leftPos, newWidth, $mainNav = $("#nav"), $mainNav2 = $(".filter_nav");
    $mainNav.append("<li id='magic-line'></li>");
    var $magicLine = $("#magic-line");
    $magicLine
        .width($(".current_page_item").width())
        .css("left", $(".current_page_item a").position().left)
        .data("origLeft", $magicLine.position().left)
        .data("origWidth", $magicLine.width());
    $("#nav li a").hover(function() {
        $el = $(this);
        leftPos = $el.position().left;
        newWidth = $el.parent().width();
        $magicLine.stop().animate({
            left: leftPos,
            width: newWidth
        });
    }, function() {
        $magicLine.stop().animate({
            left: $magicLine.data("origLeft"),
            width: $magicLine.data("origWidth")
        });    
    });
	
	
	if ( $('.filter_nav').length ) { //do something 
		
		
		
		$mainNav2.append("<li id='magic-line-two'></li>");
	    
	    var $magicLineTwo = $("#magic-line-two");
	    
	    $magicLineTwo
	        .width($(".current_page_item_two").width())
	        .height($mainNav2.height())
	        .css("left", $(".current_page_item_two a").position().left)
	        .data("origLeft", $magicLineTwo.position().left)
	        .data("origWidth", $magicLineTwo.width());
	                
	    $(".button_strip li a").hover(function() {
	        $el = $(this);
	        leftPos = $el.position().left;
	        newWidth = $el.parent().width();
	        $magicLineTwo.stop().animate({
	            left: leftPos,
	            width: newWidth
	        })
	    }, function() {
	        $magicLineTwo.stop().animate({
	            left: $magicLineTwo.data("origLeft"),
	            width: $magicLineTwo.data("origWidth")
	        });    
	    });	
	
		$(".button_strip li a").click(function() {
	        $el = $(this);
	        
	    $magicLineTwo
	        .width($el.parent().width())
	        .height($mainNav2.height())
	        .css("left", $el.position().left)
	        .data("origLeft", $el.position().left)
	        .data("origWidth", $el.parent().width());		
			
			
			
			leftPos = $el.position().left;
	        newWidth = $el.parent().width();
			
	
		});
		
	}
	
});